//
//  LCTaskTableViewCell.m
//  lechuang
//
//  Created by Mr_hi on 2023/3/22.
//  Copyright © 2023 Mooyi. All rights reserved.
//

#import "LCTaskTableViewCell.h"
#import "LCTaskModel.h"
#import "LCUserModel.h"


@interface LCTaskTableViewCell ()

@property (weak, nonatomic) IBOutlet UIImageView *iconView;
@property (weak, nonatomic) IBOutlet UILabel *nameLb;
@property (weak, nonatomic) IBOutlet UILabel *rewardPriceLb;
@property (weak, nonatomic) IBOutlet UIButton *taskTypeStrBt;
@property (weak, nonatomic) IBOutlet UIButton *projectNameBt;
@property (weak, nonatomic) IBOutlet UILabel *msgLb;

@end

@implementation LCTaskTableViewCell

- (void)awakeFromNib {
    [super awakeFromNib];
}

-(void)setTask:(LCTaskModel *)task {
    _task = task;
    self.nameLb.text = task.taskTitle;
    self.rewardPriceLb.text = kFORMAT(@"%@元",task.rewardPrice);
    [self.projectNameBt setTitle:kFORMAT(@"%@",task.projectName) forState:UIControlStateNormal];
    [self.taskTypeStrBt setTitle:kFORMAT(@"%@",task.taskTypeStr) forState:UIControlStateNormal];
    self.msgLb.text = kFORMAT(@"已赚：%ld", (long)task.completedNum);
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];
}

@end

@interface LCSearchTaskTableViewCell ()

@property (weak, nonatomic) IBOutlet UIImageView *iconView;
@property (weak, nonatomic) IBOutlet UILabel *nameLb;
@property (weak, nonatomic) IBOutlet UILabel *rewardPriceLb;

@property (weak, nonatomic) IBOutlet UILabel *descLb;

@property (weak, nonatomic) IBOutlet UILabel *msgLb;

@end

@implementation LCSearchTaskTableViewCell

- (void)awakeFromNib {
    [super awakeFromNib];
}

-(void)setTask:(LCXunKaTaskModel *)task {
    _task = task;
    [self.iconView sd_setImageWithURL:[LCFunction XWX_URLImg:task.appthumb]];
    self.nameLb.text = task.appname;
    self.rewardPriceLb.text = kFORMAT(@"%@元",task.appreward);
    self.descLb.text = kFORMAT(@"%@",task.strdescription);
//    self.msgLb.text = kFORMAT(@"剩余：%ld", task.kuncun.integerValue-task.usenum.integerValue);
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];
}

@end



@interface LCGameTaskTableViewCell ()

@property (weak, nonatomic) IBOutlet UIImageView *iconView;
@property (weak, nonatomic) IBOutlet UILabel *titleLb;
@property (weak, nonatomic) IBOutlet UILabel *msgLb;

@property (weak, nonatomic) IBOutlet UILabel *playNumLb;
@property (weak, nonatomic) IBOutlet UILabel *periodLb;
@property (weak, nonatomic) IBOutlet UILabel *priceLb;

@end


@implementation LCGameTaskTableViewCell

- (void)awakeFromNib {
    [super awakeFromNib];
}

-(void)setTask:(LCGameTaskModel *)task {
    _task = task;
    [self.iconView sd_setImageWithURL:[NSURL URLWithString:task.product_icon]];
    self.titleLb.text = task.title;
    self.msgLb.text = task.product_introduction;
    self.playNumLb.text = kFORMAT(@"%ld人试玩",task.account_count);
    self.periodLb.text = kFORMAT(@"%@期",task.period);
    self.priceLb.text = kFORMAT(@"%@元",task.price_desc);
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];
}

@end

@interface LCCardTaskTableViewCell ()

@property (weak, nonatomic) IBOutlet UIImageView *iconView;

@property (weak, nonatomic) IBOutlet UILabel *nameLb;

@property (weak, nonatomic) IBOutlet UILabel *destalsLb;

@property (weak, nonatomic) IBOutlet UILabel *salesLb;

@end

@implementation LCCardTaskTableViewCell

- (void)awakeFromNib {
    [super awakeFromNib];
}

-(void)setTask:(LCCardTaskModel *)task {
    _task = task;
    [self.iconView sd_setImageWithURL:[NSURL URLWithString:task.tips] placeholderImage:[UIImage imageNamed:@"lc_task_task_icon"]];
    self.nameLb.text = task.name;
    NSMutableArray * labelArr = [NSMutableArray array];
    
    for (NSDictionary * dic in task.tagsSelect) {
        [labelArr addObject:dic[@"label"]];
    }
    
    self.destalsLb.text = [labelArr componentsJoinedByString:@"|"];
    self.salesLb.text = [NSString stringWithFormat:@"销量：%@",task.sales];
    
//    LCUserModel * userInfo = [LCUserModel mj_objectWithKeyValues:LCUserDefGet(UserInfo)];
//
//    CGFloat price = task.reward.floatValue * self.sysPoint * (100-userInfo.cardrate.integerValue)/100.0;
//
//    self.priceLb.text = kFORMAT(@"+%.2f元",price);
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];
}

@end


@interface LCXunKaTaskTableViewCell ()

@property (weak, nonatomic) IBOutlet UIImageView *iconView;

@property (weak, nonatomic) IBOutlet UILabel *nameLabel;

@property (weak, nonatomic) IBOutlet UILabel *conditionLb;

@property (weak, nonatomic) IBOutlet UILabel *priceLb;

@end


@implementation LCXunKaTaskTableViewCell

- (void)awakeFromNib {
    [super awakeFromNib];
}

-(void)setTask:(LCXunKaTaskModel *)task {
    _task = task;
    [self.iconView sd_setImageWithURL:[LCFunction XWX_URLImg:task.appthumb]];
    self.nameLabel.text = task.appname;
    self.conditionLb.text = task.strdescription;
    self.priceLb.text = kFORMAT(@"%@元",task.appreward);
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];
}

@end
